from enum import verify

import requests
from requests.auth import HTTPBasicAuth

# # 请求地址
# url  = 'http://127.0.0.1:8000/admin/'
# # 发起请求
# # allow_redirects=False (状态码为302)禁止重定向 default=True
# # response = requests.get(url,allow_redirects=False)
# response = requests.get(url,allow_redirects=False)
# print(response.status_code)
# print(response.headers.get('Location'))
# location = response.headers.get('Location')
#
# # 当allow_redirects=False时，返回的响应状态码为302
# #   一般需要获取重定向后的Location
# # 当allow_redirects=True时，返回的响应状态码为200
# # 则不需要这一步，因为请求的地址就是重定向后的地址（/admin/login/?next=/admin/）
# response = requests.get(f'http://127.0.0.1:8000{location}')
# print(response.status_code)
# print(response.text)


# url  = 'http://127.0.0.1:8000/admin/'
# # header = {
# # 	'cookie': 'sessionid=j3t4pdvxz1s2yejh5omzmgm14o40ygdr'
# # }
# response = requests.get(url,cookies={'sessionid':'j3t4pdvxz1s2yejh5omzmgm14o40ygdr'})
# print(response.status_code)
# print(response.text)


# url  = 'http://127.0.0.1:8000/admin/'
#
# response = requests.get(url,auth=HTTPBasicAuth('admin','123456'))
# print(response.status_code)
# print(response.text)

# verify 校验证书 default=True
# 对于需要校验证书的网站，需要设置verify=False
